package com.nuanshui.heatedloan.web.credit;

import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSON;
import com.nuanshui.heatedloan.constant.GlobalParam;
import com.nuanshui.heatedloan.credit.facade.AllinPayRecordService;
import com.nuanshui.heatedloan.credit.model.record.AllinPayReqRecord;
import com.nuanshui.heatedloan.credit.pay.AllinPayResultNotify;
import com.nuanshui.heatedloan.pageable.Pager;
import com.nuanshui.heatedloan.web.ApiController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cms/manage/allinpayresultnotify")
public class AllinPayResultNotifyController extends ApiController {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Reference(url = GlobalParam.CREDIT_DUBBO_SERVER, timeout = GlobalParam.DUBBO_SERVER_TIME_OUT, version = GlobalParam.CREDIT_DUBBO_SERVER_VERSION)
	private AllinPayRecordService allinPayRecordService;

	@RequestMapping("/list")
	public String list(Pager<AllinPayResultNotify> pager, String query) {

		AllinPayResultNotify itemEntity = null;
		if (StringUtils.isNotEmpty(query) && !DEFAULTQUERYSTR.equals(query)) {
			itemEntity = JSON.parseObject(query, AllinPayResultNotify.class);
		}
		pager = allinPayRecordService.findResultNotifyListByPage(pager, itemEntity);

		return success(pager.asHashMap());
	}
}
